<!doctype html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
    <title>微分享-后台管理系统</title>
    <meta name="description" content="微分享-后台管理系统"/>
    <meta name="keywords" content="index"/>
    <meta name="viewport" content="width=device-width, initial-scale=1"/>
    <meta name="renderer" content="webkit"/>
    <meta http-equiv="Cache-Control" content="no-siteapp"/>
    <link rel="shortcut icon" th:href="@{/static/img/favicon.ico}" />
    <link rel="stylesheet" th:href="@{/static/assets/css/amazeui.min.css}"/>
    <link rel="stylesheet" th:href="@{/static/assets/css/admin.css}"/>
    <link rel="stylesheet" th:href="@{/static/lib/layer/skin/layer.css}" />
    <script th:src="@{/static/assets/js/jquery.min.js}"></script>
    <script th:src="@{/static/assets/js/amazeui.min.js}"></script>
    <script th:src="@{/static/assets/js/app.js}"></script>
    <script th:src="@{/static/js/public.js}"></script>
	<script type= "text/javascript" th:src ="@{/static/lib/layer/layer.js}"></script>   
	<script type= "text/javascript" th:src ="@{/dwr/util.js}"></script>   
	<script type="text/javascript" th:src= "@{/dwr/engine.js}"></script > 
	<script type="text/javascript" th:src= "@{/dwr/interface/NoticeContentController.js}"></script>
	<script type="text/javascript" th:src= "@{/static/js/dwrhelp.js}"></script>
</head>
<body>
<!--[if lte IE 9]>
<p class="browsehappy">你正在使用<strong>过时</strong>的浏览器，Amaze UI 暂不支持。 请 <a href="http://browsehappy.com/" target="_blank">升级浏览器</a>
    以获得更好的体验！</p>
<![endif]-->

<header class="am-topbar am-topbar-inverse admin-header">
    <div class="am-topbar-brand">
        <strong>微分享</strong>
        <small>后台管理系统</small>
    </div>

    <div class="am-collapse am-topbar-collapse" id="topbar-collapse">

        <ul class="am-nav am-nav-pills am-topbar-nav am-topbar-right admin-header-list">
            <li class="am-dropdown" id="am-dropdown">
                <a class="am-dropdown-toggle" href="javascript:;">
                    <span class="am-icon-users"></span> 管理员<span th:text="${session.userName}"></span><span class="am-icon-caret-down"></span>
                </a>
                <ul class="am-dropdown-content">
                  <li><a th:href="@{/admin-user}"><span class="am-icon-user"></span> 资料</a></li>
		          <li><a href="logout"><span class="am-icon-power-off"></span> 退出</a></li>
                </ul>
            </li>
            <li class="am-hide-sm-only"><a href="javascript:;" id="admin-fullscreen"><span
                    class="am-icon-arrows-alt"></span> <span class="admin-fullText">开启全屏</span></a></li>
        </ul>
    </div>
</header>

<div class="am-cf admin-main">
    <!-- sidebar start -->
    <div class="admin-sidebar am-offcanvas" id="admin-offcanvas">
        <div class="am-offcanvas-bar admin-offcanvas-bar">
            <ul class="am-list admin-sidebar-list">
                <li><a href="admin_index"><span class="am-icon-home"></span>内容管理</a></li>
                <li><a href="admin_users"><span class="am-icon-table"></span>用户管理</a></li>
                <li><a href="admin_add_pictureshare"><span class="am-icon-table"></span>添加分享</a></li>
                <li><a href="register"><span class="am-icon-table"></span>管理员注册</a></li>
                <li><a href="logout"><span class="am-icon-sign-out"></span> 注销</a></li>
            </ul>

            <div class="am-panel am-panel-default admin-sidebar-panel">
                <div class="am-panel-bd">
                    <p><span class="am-icon-bookmark"></span> 公告</p>
                    <p>时光静好，与君语；细水流年，与君同。</p>
                </div>
            </div>
        </div>
    </div>
    <!-- sidebar end -->

    <!-- content start -->
    <div class="admin-content">
        <div class="admin-content-body">
            <div class="am-cf am-padding am-padding-bottom-0">
                <div class="am-fl am-cf">
                    <strong class="am-text-primary am-text-lg">添加分享</strong> /
                    <small>form</small>
                </div>
            </div>

            <div class="am-tabs am-margin" data-am-tabs="">
                <ul class="am-tabs-nav am-nav am-nav-tabs">
                    <li class="am-active"><a href="#tab1">添加分享</a></li>
                    <li><a href="#tab2">添加评论</a></li>
                </ul>

                <div class="am-tabs-bd">
                    <div class="am-tab-panel am-fade am-in am-active" id="tab1">
                        <form id="pictureshareform" class="am-form" action="picture_share" method="post" enctype="multipart/form-data">
                            <div class="am-g am-margin-top-sm">
                                <div class="am-u-sm-12 am-u-md-2 am-text-right admin-form-text">
                                    内容描述
                                </div>
                                <div class="am-u-sm-12 am-u-md-10">
                                    <textarea name="remark" rows="10" placeholder="说点儿什么吧"></textarea>
                                </div>
                                <div class="am-u-sm-12 am-u-md-2 am-text-right admin-form-text">
                                    图片
                                </div>
                                <div id="pictureContent" class="am-u-sm-12 am-u-md-10">
                                    <input type="file" name="pictures"/>
                                </div>
                            </div>
                            <input name="page"  value="all_share"  hidden="true"/>
                            <div class="am-margin">
                                <button type="button" class="am-btn am-btn-primary am-btn-xs"
                                        onclick="addPictureInput();">添加图片
                                </button>
                                <button type="submit" class="am-btn am-btn-primary am-btn-xs">提交保存</button>
                                <button type="reset" class="am-btn am-btn-primary am-btn-xs">放弃保存</button>
                                 <span style="color: red;"  th:text="${result}"></span>
                            </div>
                        </form>
                    </div>

                    <div class="am-tab-panel am-fade" id="tab2">
                        <form class="am-form" method="post" action="comment">
                            <div class="am-g am-margin-top-sm">
                                <div class="am-u-sm-4 am-u-md-2 am-text-right">
                                    评论内容ID
                                </div>
                                <div class="am-u-sm-8 am-u-md-4 am-u-end">
                                    <input type="text" name="pictureShareId" id="pictureShareId" class="am-input-sm"/>
                                </div>
                            </div>

                            <div class="am-g am-margin-top-sm">
                                <div class="am-u-sm-4 am-u-md-2 am-text-right">
                                    评论内容
                                </div>
                                <div class="am-u-sm-8 am-u-md-4 am-u-end">
                                    <textarea name="comment" id="comment" rows="10" placeholder="说点儿什么吧"></textarea>
                                </div>
                            </div>
                            <input type="hidden" name="accessToken" id="accessToken1"/>
                            <div class="am-margin">
                                <button type="button" onclick="addComment()" class="am-btn am-btn-primary am-btn-xs">
                                    提交保存
                                </button>
                                <button type="reset" class="am-btn am-btn-primary am-btn-xs">放弃保存</button>
                            </div>
                        </form>
                    </div>
                </div>
            </div>

        </div>

        <footer class="admin-content-footer">
            <p class="am-padding-left">周航@成都信息工程大学, All Rights Reserved.</p>
        </footer>
    </div>
    <!-- content end -->

</div>
<!-- content end -->
<a href="#" class="am-icon-btn am-icon-th-list am-show-sm-only admin-menu"
   data-am-offcanvas="{target: '#admin-offcanvas'}"></a>
<script>
/*<![CDATA[*/
    function addPictureInput() {
        $("#pictureContent").append("<input type=\"file\" name=\"pictures\">");
    }
    function addComment() {
        $.ajax({
            url: "/comment",
            data: {
                comment: encodeURI($("#comment").val()),
                pictureShareId: $("#pictureShareId").val()
            },
            success: function (msg) {
            	console.info(msg);
                if (msg) {
                    alert("评论成功");
                    window.location.reload();
                }
            }
        });
    }
    /*]]>*/
</script>
</body>
</html>